/*================================================================
*   文件名称：main.cpp
*   创 建 者：yang qiang
*   创建日期：2021年02月28日
*   描    述：
*   Copyright (C) 2021 All rights reserved.
*
* ================================================================*/


#include <iostream>
#include <vector>
#include <string>
using namespace std;

void get_min_distance(string &s1, string &s2, int m, int n, vector<vector<int>> &dp){
    for(int i = 0; i <= n; i++){
        dp[0][i] = i;
    }
    for(int j = 0; j <= m; j++){
        dp[j][0] = j;
    }

    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= n; j++){
            if(s1[i-1] == s2[j-1]){
                dp[i][j] = dp[i-1][j-1];
            }else{
                int dp_min = min(dp[i-1][j] + 1, dp[i][j-1] + 1);
                dp_min = min(dp_min, dp[i-1][j-1] + 1);
                dp[i][j] = dp_min;
            }

        }
    }

    cout << dp[m][n] << endl;
}

int main(){
    string s1, s2;
    while(cin >> s1 >> s2){
        int m = s1.size();
        int n = s2.size();

        vector<vector<int>>dp(m+1, vector<int>(n + 1, 0));

        get_min_distance(s1, s2, m, n, dp);
    }
}
